<%@ page import="java.util.List" %>

<%@ page import="java.util.ArrayList" %>
<%@ page import="cn.NewsDao.NewsDao1" %>
<%@ page import="cn.NewsDaoImpl.NewsDaoImpl1" %>
<%@ page import="cn.entity.News1" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title></title>


  </head>
  <body>


    <%
      //NewsService newsService = new NewsServiceImpl();
        NewsDao1 newsDao1 = new NewsDaoImpl1();


         //List<News> newsList= newsService.ServiceSelectAll();
        //初始化分页参数
         int index=0;
         int crenCount=1;
         List<News1> newsList= (List<News1>) session.getAttribute("list");
         Object  index1= session.getAttribute("index1");


         if (index1==null){
             index=1;
         }else {
             index= (int) session.getAttribute("index1");
         }

        if(newsList ==null){
            newsList=newsDao1.getNewsList();

        }

   %>
    <div>
      <table style="border-color: red;border:1px solid;">
    <%
      for (int i=0;i<newsList.size();i++) {
    %>
        <tr>
           <td>
             <%=newsList.get(i).getId()%>
           </td>
          <td>
            <%=newsList.get(i).getCategoryId()%>
          </td>
          <td>
            <%=newsList.get(i).getTitle()%>
          </td>


            <td>

                <img src="<%=newsList.get(i).getPicPath()%>"/>
            </td>
            <td><a href="DeleteManege.jsp?newsid=<%=newsList.get(i).getId()%>">删除</a></td>
            <td><a href="UpdateManege.jsp?newsid=<%=newsList.get(i).getId()%>">修改</a></td>
            <td><a href="#">添加</a></td>
        </tr>

    <%
      }
    %>
       <tr>
           <td><a href="pageManage.jsp?index=<%=1%>&crenCount=<%=crenCount%>">首页</a></td>
           <td><a href="pageManage.jsp?index=<%=(index-1)<0 ? 0:index-1%>&crenCount=<%=crenCount%>">上一下</a></td>
           <td><a href="pageManage.jsp?index=<%=index+1%>&crenCount=<%=crenCount%>">下一页</a></td>
           <td>当前页</td>
           <td> /</td>

           <td>总页数：<%=newsList.size()%></td>
           <td><a href="pageManage.jsp?index=<%=newsList.size()-1%>&crenCount=<%=crenCount%>">尾页</a></td>



       </tr>
      </table>
    </div>
  </body>
</html>